<script setup>
import { ref, reactive, onMounted } from 'vue'
import * as echarts from 'echarts'


function initChart() {
  const dataDate=['01月', '02月', '03月', '04月', '05月', '06月', '07月', '08月', '09月', '10月', '11月', '12月']
  const dataVal=[120,130,150,80,120,90, 120, 130, 150, 180, 120, 90]
  const option = {

  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'cross',
      label: {
        backgroundColor: '#6a7985'
      }
    }
  },

  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  xAxis: [
    {
      type: 'category',
      boundaryGap: false,
      data: dataDate
    }
  ],
  yAxis: [
    {
      type: 'value'
    }
  ],
  series: [
    {
      name: 'Email',
      type: 'line',
      stack: 'Total',
      areaStyle: {},
      emphasis: {
        focus: 'series'
      },
      data: dataVal
    },
  ]
};
  echarts.init(document.querySelector('#content-right')).setOption(option)
}

onMounted(() => {
  initChart()
})
</script>

<template>
  <div class="bottom-left">
    <div class="title">月度水总量趋势</div>
    <div class="content">
      <div class="content-left">
        <div class="content-left-top">
          <span>本月用水量</span>
          <div>200吨</div>
        </div>
        <div class="content-left-bottom">
          <span>回环比</span>
          <div>85.1%</div>
        </div>
      </div>
      <div id="content-right"></div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.bottom-left {
  width: 45%;
  height: 100%;
  margin-bottom: 10px;
  .title {
    text-align: left;
    text-indent: 1rem;
    height: 40px;
    line-height: 40px;
    color: rgb(18, 157, 238);
    font-size: 20px;
    font-weight: bold;
  }
  .content {
    width: 100%;
    height: 250px;
    background-color: $bigScreenBg;
    display: flex;
    @include colorWhite;
    .content-left {
      width: 140px;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: space-around;
    }
    #content-right {
      flex: 1;
    }
  }
}
</style>
